﻿@using SH = EMoney.IStock.Client.Framework.StringHelper;

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>英雄榜</title>
    <link rel="stylesheet" type="text/css" href="@SH.GetStaticFile("IStockClientStatic/cpyx/css/main.css?t=20140821")" id="linkcss" />
    <script src="http://static.emoney.cn/js/libs/jquery.min.1.8.3.js" type="text/javascript"></script>
    <style type="text/css">
        .jscroll-c{top: 0px; z-index: 9999; zoom: 1; position: relative;overflow:hidden;}
        .jscroll-e{height: 100%; top: 0px; right: 0; -moz-user-select: none; position: absolute; overflow: hidden; z-index: 10000; background: url(http://static.emoney.cn/www/emfastock/img/scrollbarblock2.gif) -33px 0 repeat-y;}
        .jscroll-u{position: absolute; top: 0px; width: 100%; left: 0; overflow: hidden; background: trasparent;}
        .jscroll-h{position: absolute;left: 0px; -moz-user-select: none; border: 0; overflow: hidden; text-align: center;}
        .jscroll-bart{width: 11px; height: 6px; background: url(http://static.emoney.cn/www/emfastock/img/scrollbarblock2.gif) no-repeat -1px -1px; overflow: hidden;}
        .jscroll-h-i{width: 13px; height: 5px; background: url(http://static.emoney.cn/www/emfastock/img/scrollbarblock2.gif) repeat-y -16px top; overflow: hidden;}
        .jscroll-h-s{width: 13px; height: 100%; background: url(http://static.emoney.cn/www/emfastock/img/scrollbarblock2.gif) no-repeat -52px center; overflow: hidden;}
        .jscroll-barb{width: 11px; height: 6px; background: url(http://static.emoney.cn/www/emfastock/img/scrollbarblock2.gif) no-repeat -1px -10px; overflow: hidden;}
        .jscroll-d{position: absolute; bottom: 0px; width: 100%; left: 0; overflow: hidden; background: trasparent;}
        .scroll-pane{ margin-left:5px;}
    </style>
</head>
<body>
    <div class="main">
        <div id="navmenu" style="text-align:center;padding-top:5px;padding-bottom:4px;">
           <ul><li class="on" flag="cw"><div class="L"><b>本周英雄</b></div></li><li flag="pw"><div class="M"><b>上周英雄</b></div></li><li flag="ppw"><div class="R"><b>上上周英雄</b></div></li></ul>
        </div>
        <div class="add_k">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" id="">
                <tr>
                    <th align="center" style="width: 20%;" class="cwhite">名次</th>
                    <th align="center" style="width: 20%;" class="cwhite">用户名</th>
                    <th align="center" style="width: 20%;" class="cwhite">收益率</th>
                    <th align="center" style="width: 20%;" class="cwhite">胜利率</th>
                    <th align="center" style="width: 20%;" class="cwhite">总局数</th>
                </tr>
            </table>
            <div id="scrollBox1" class="scrollBox" scrollflag style="height: 210px;">
                <table width="100%" id="" border="0" cellspacing="0" cellpadding="0">
                    <thead style="height: 0px; display: none;">
                        <tr>
                            <th align="center" style="width:20%;">名次</th>
                            <th align="center" style="width:20%;">用户名</th>
                            <th align="center" style="width:20%;">收益率</th>
                            <th align="center" style="width:20%;">胜利率</th>
                            <th align="center" style="width:20%;">总局数</th>
                        </tr>
                    </thead>
                    <tbody id="yxbbody"></tbody>
                </table>
            </div>
            <div style="margin-left:280px;color:#556376;padding-top:4px;text-align:center;display:none;" id="divTime"></div>
            <div id="divTips" style="display:none;position:fixed;z-index:2147483647;top:275px;left:27px;height:20px;width:406px;background-color:#F4F4D7;color:#5A5A5A;line-height:20px;font-size:12px;text-align:center;">
                <a href="javascript:;" class="close" style="display:block;width:20px;height:20px;float:right;font-size:18px;color:#000;">×</a>【温馨提示】每周日24:00榜单数据重置，距离重置还剩 @ViewBag.ResetTips</div>
        </div>
    </div>
</body>
    <script src="@SH.GetStaticFile("IStockClientStatic/js/EMWEBUIscrollBar.js")" type="text/javascript"></script>
    <script src="@SH.GetStaticFile("IStockClientStatic/js/common.js")" type="text/javascript"></script>
    <script src="@SH.GetStaticFile("IStockClientStatic/js/istockfunc.js")" type="text/javascript"></script>
</html>
<script type="text/javascript">
    var www = "@Url.Content("~/")", week = "cw", userid = GetUserID() - 399500;

    $(document).ready(function () {
        $("#scrollBox1").height(210);

        $(".scrollBox").jscroll({ W: "8px", IW: "8px", CurrT: 0, Bar: { Pos: "up" }, Btn: { btn: false }, Fn: function () { } }).hover(function (e) {
            var thisbx = $(this), scrlbr = $(this).find(".jscroll-e");
            if (!scrlbr.hasClass("non")) {
                scrlbr.addClass("mon").stop(true, true, false).show();
            }
        }, function (e) {
            var thisbx = $(this), scrlbr = $(this).find(".jscroll-e");
            if (!scrlbr.hasClass("non")) {
                scrlbr.removeClass("mon");
                if (scrlbr.hasClass("vxdrag")) { } else {
                    //scrlbr.fadeOut("slow");
                }
            }
        });

        $("#navmenu ul li").click(function () {
            week = $(this).attr("flag");
            $(this).addClass("on").siblings().removeClass("on");

            getYxb();
        });

        $(".close").click(function () {
            $("#divTips").hide();
            $("#divTime").show();

            if (!isNaN(userid) && userid > 0) {
                $.post(www + "cpyx/ct", { uid: userid }, function (data) {
                });
            }
        });
        
        if (isNaN(userid) || userid == 0) {
            $("#divTime").show();
            $("#divTips").hide();
        }
        else {
            $.post(www + "cpyx/gt", { uid: userid }, function (data) {
                if (data == "1") {
                    $("#divTime").show();
                }
                else {
                    $("#divTime").hide();
                    $("#divTips").show();
                }
            });
        }

        getYxb();
    });

    function getYxb() {
        $.ajax({
            type: "post",
            url: www + "cpyx/armory",
            data: { week: week, uid: userid },
            datatype: "text",
            success: function (data) {
                if (data != "") {
                    var obj = eval('(' + data + ')');

                    if (obj != null && obj.length > 0) {
                        var html = "", color = "", rowsCount = 0, mydata = "0";

                        $.each(obj, function (i) {
                            if ($("#divTime").html() == "") {
                                if (userid == "" || userid == "0") {
                                    $("#divTime").css("color", "#FF5D62");
                                    $("#divTime").html("想进英雄榜，赶紧先去<a href='javascript:;' onclick='ISTOCK_FUNC_REG();' style='text-decoration:underline;'>注册</a>吧！");
                                }
                                else {
                                    $("#divTime").css("margin-left", "330px");
                                    $("#divTime").html("更新时间：" + obj[i].time);
                                }
                            }

                            if (obj[i].Idx <= 3 || obj[i].UserId == userid) {
                                color = "cyellow";

                                if (obj[i].UserId == userid) {
                                    mydata = "1";
                                }
                            }
                            else {
                                color = "cwhite";
                            }

                            if (rowsCount == 0) {
                                rowsCount = obj[i].RowsCount;
                            }

                            html += "<tr>";
                            html += "<td align=\"center\" style=\"width:20%;\" class=\"" + color + "\">" + obj[i].Idx + "</td>";
                            html += "<td align=\"center\" style=\"width:20%;\" class=\"" + color + "\" title=\"" + obj[i].UserName + "\">" + formatLongText(obj[i].UserName, 11) + "</td>";
                            html += "<td align=\"center\" style=\"width:20%;\" class=\"" + formatColor(obj[i].Profit, "cred", "cgreen", "cwhite") + "\">" + formatFloat(obj[i].Profit, 2) + "%</td>";
                            html += "<td align=\"center\" style=\"width:20%;\" class=\"" + formatColor(obj[i].Win, "cred", "cgreen", "cwhite") + "\">" + formatFloat(obj[i].Win, 2) + "%</td>";
                            html += "<td align=\"center\" style=\"width:20%;\" class=\"cwhite\">" + obj[i].Total + "</td>";
                            html += "</tr>";
                        });

                        if (mydata == "0" && userid > 0) {
                            html += "<tr><td colspan='5' class='cwhite' align='center'>亲，你尚未进入英雄榜，继续努力哟</td></tr>";
                        }

                        if (html != "") {
                            $("#yxbbody").html(html);
                        }
                    }
                }
                else {
                    $("#yxbbody").html("<tr><td colspan='4' align='center' style='color:grey;'><div style='line-height:210px;'>暂无记录<div></td></tr>");
                }

                ReSetScroll("#scrollBox1");
            },
            beforeSend: function () {
                $("#yxbbody").html("<tr><td colspan='4' align='center' style='color:grey;'><div style='line-height:210px;'>数据加载中...<div></td></tr>");
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                //alert(XMLHttpRequest.status);
            }
        });
    }
</script>